/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upf.editor;

import java.io.File;
import javax.swing.filechooser.FileFilter;

/**
 *
 * @author beto
 */
public class ImageFilters {

    private JPGFilter jpgFilter;
    private PNGFilter pngFilter;
    private GIFFilter gifFilter;

    public ImageFilters(){
        jpgFilter = new JPGFilter();
        pngFilter = new PNGFilter();
        gifFilter = new GIFFilter();
    }

    class JPGFilter extends javax.swing.filechooser.FileFilter {

        @Override
        public boolean accept(File f) {
            return f.isDirectory() || f.getName().toLowerCase().endsWith(".jpg");
        }

        @Override
        public String getDescription() {
            return "JPG files";
        }
    }

    class PNGFilter extends javax.swing.filechooser.FileFilter {

        @Override
        public boolean accept(File f) {
            return f.isDirectory() || f.getName().toLowerCase().endsWith(".png");
        }

        @Override
        public String getDescription() {
            return "PNG files";
        }
    }

    class GIFFilter extends javax.swing.filechooser.FileFilter {

        @Override
        public boolean accept(File f) {
            return f.isDirectory() || f.getName().toLowerCase().endsWith(".gif");
        }

        @Override
        public String getDescription() {
            return "GIF files";
        }
    }

    public FileFilter getJPGFilter(){
        return jpgFilter;
    }

    public FileFilter getPNGFilter(){
        return pngFilter;
    }

    public FileFilter getGIFFilter(){
        return gifFilter;
    }

    
}
